<template lang="">
  <div>
      <div v-for="i in list">
          <van-field :label="i.name" v-model="values[i.name]"/>
      </div>
      <van-button @click="submit">提交</van-button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            wid:this.$route.query.id,
            list:[],
            values:{}
        }
    },
    methods:{
        startWorkf(){
            //根据id查询params
            this.axios.get('setparams?wid='+this.wid).then(res=>{
                this.list = JSON.parse(res.data.workf.params)
            })
        },
        submit(){
            this.axios.post('setparams',{'userid':1,'wid':this.wid,'params':JSON.stringify(this.values)}).then(res=>{
                alert('添加成功')
                this.startWorkf()
            })
        }
    },
    mounted(){
        this.startWorkf()
    }
}
</script>

<style>

</style>

